import log from "./logger";

const net = require('net');
const socket = new net.Socket();
const port = 12012;
const hostname = '127.0.0.1';


socket.connect(port, hostname);
socket.on('data', function (buffer: any) {
    let s = buffer.toString();
    log.info(s);
    let strings = s.split('|');
    log.info(strings[4]);
});

socket.on('error', function (error: any) {
    log.info(error);
});

socket.on('close', function () {
    log.info('服务器端下线了');
    setTimeout(() => {
        socket.connect(port, hostname);
    }, 5000)
});
